<@cms.category id=categoryId!>
    <#assign category=object/>
    <@cms.model id=modelId!>
        <#assign
            model=object
            fieldList=model.fieldList![]
            requiredFieldList=model.requiredFfieldList![]
        />
<#assign formContent>
    <#if category.allowContribute>
<#noparse><#if user?has_content>
<@cms.content id=id>
    <#assign content=object/>
    <#assign attribute=getContentAttribute(object.id)/>
</@cms.content>
<form name="contribute" method="post" action="${site.dynamicPath}content/save">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken/>"/>
    <input name="returnUrl" type="hidden" value="${site.dynamicPath}"/></#noparse>
    <input name="categoryId" type="hidden" value="${category.id!}"/>
    <input name="modelId" type="hidden" value="${model.id!}"/>
<#if fieldList?seq_contains('author')>
    <input name="author" type="hidden" value="<#noparse>${(user.nickname)!}</#noparse>"/>
</#if>
    <p>
        <label>${(model.fieldTextMap['title'])!}:</label>
        <input name="title" type="text" size="60" required="true" maxlength="255" value="<#noparse>${(content.title)!}</#noparse>"/>
    </p>
<#if fieldList?seq_contains('description')>
    <p>
        <label>${(model.fieldTextMap['description'])!}:</label>
        <textarea name="description" cols="80" rows="20" maxlength="300"><#noparse>${(content.description)!}</#noparse></textarea>
    </p>
</#if>
<#if model.onlyUrl>
    <p>
        <label>${(model.fieldTextMap['url'])!}:</label>
        <input name="url" type="text" size="60" maxlength="1000" value="<#noparse>${(content.url)!}</#noparse>"/>
    </p>
</#if>
<#if fieldList?seq_contains('content')>
    <p>
        <label>${(model.fieldTextMap['content'])!}:</label>
        <textarea name="text" class="editor" cols="80" rows="20"><#noparse>${(attribute.text)!}</#noparse></textarea>
    </p>
</#if>
    <#include "../include_page/extendData.html"/>
    <@sys.extendFieldList extendId=category.extendId>
        <@extendData extendList=list extendValues=attribute type="customform"/>
    </@sys.extendFieldList>
    <@extendData extendList=model.extendList extendValues=attribute type="customform"/>
<#noparse>
    <@sys.configData code="safe">
        <#if object.captcha?has_content && object.captcha?split(",")?seq_contains("contribute")>
    <p>
        <input name="captcha" required="true" type="text" autocomplete="off" placeholder="Captcha" title="Captcha"/>
        <img src="${site.dynamicPath}getCaptchaImage?${.now?long}" alt="captcha" onclick="this.src=this.src+'&'+new Date().getTime()"/>
    </p>
        </#if>
    </@sys.configData>
</#noparse>
    <p><input type="submit" value="<@t.page 'button.save'/>"/></p>
</form>
<#noparse>
<script src="${site.dynamicPath}resource/js/loadscripts.js"></script>
<script>
var editors = document.querySelectorAll(".editor");
if(editors.length){
    window.UEDITOR_HOME_URL = "${site.dynamicPath}resource/plugins/ueditor/";
    var base="${site.dynamicPath}";
    loadScripts(["${site.dynamicPath}resource/plugins/ueditor/ueditor.config.js","${site.dynamicPath}resource/plugins/ueditor/ueditor.all.min.js","${site.dynamicPath}resource/plugins/ueditor/lang/</#noparse><@t.page 'ueditor.lang_js'/><#noparse>"],function(){
        window.UEDITOR_CONFIG.topOffset=0;
        for(var key in editors){
            var editor = new baidu.editor.ui.Editor();
            editor.render(key);
        }
        document.querySelector("form[name=contribute]").onsubmit=function(){
            for(var key in editors){
                UE.getEditor(key).sync();
            }
        }
    });
}
</script>
<#else>
please <a href="${site.dynamicPath}login.html">login</a>
</#if></#noparse><#else><@t.message 'verify.custom.contribute'/></#if></#assign>
    </@cms.model>
</@cms.category>
    <dl>
        <dt><@t.page 'category'/>:</dt>
        <dd>
            ${(category.name)!}
        </dd>
    </dl>
    <dl>
        <dt><@t.page 'model'/>:</dt>
        <dd>
            ${(model.name)!}
        </dd>
    </dl>
    <dl class="nowrap">
        <dt><@t.page 'source_code'/>:</dt>
        <dd>
            <textarea  class="code" mode="freemarkermixed"><@html_escape>${(formContent)!}</@html_escape></textarea>
        </dd>
    </dl>